﻿using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace shop.Model
{
    public class BackgroundJob
    {
        [Column(IsPrimary =true, IsIdentity =true)]
        public int id {  get; set; }    

        [Column(StringLength =30)]
        public string FUser { get; set; }

        [Column(StringLength =50)]
        public string UserId { get; set; }

        public DateTime CreateTime { get; set; }

        public DateTime? DoneTime { get; set; }

        [Column(StringLength =100)]
        public string JobName { get; set; } 

        [Column(StringLength =500)]
        public string JobRemarks { get; set; }  

        [Column(StringLength =100)]
        public string JobStatus 
        { 
            get
            {
                if(this.IsCompleted)
                {
                    return this.IsFailed ? "失败" : "完成";
                }
                else
                {
                    return "正在运行";
                }
            }
            //set; 
        }

        [Column(StringLength =500)]
        public string FileLink { get; set; }

        [Column(StringLength =50)]
        public string JobId { get; set; }

        public bool IsCompleted { get; set; }

        /// <summary>  </summary>
        [Column (StringLength =500)]
        public string FailReason { set; get; }

        public bool IsFailed { get; set; }


        public bool Isdel { get; set; }


    }
}
